# coding:utf-8
from __future__ import unicode_literals

from datetime import datetime
from django.db import models


# Create your models here.
class City(models.Model):
    name = models.CharField(max_length=100, verbose_name=u'城市名字')
    desc = models.CharField(max_length=200, verbose_name=u'城市描述')
    add_time = models.DateTimeField(default=datetime.now, verbose_name=u'添加时间')

    class Meta:
        verbose_name = u'城市信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name


class CourseOrg(models.Model):
    name = models.CharField(max_length=100, verbose_name=u'机构名字')
    desc = models.CharField(max_length=200, verbose_name=u'机构描述')
    fav_nums = models.IntegerField(default=0, verbose_name=u'收藏人数')
    image = models.ImageField(upload_to='org/%Y/%m', verbose_name=u'机构图片')
    click_nums = models.IntegerField(default=0, verbose_name=u'点击数')
    adress = models.CharField(max_length=150, verbose_name=u'机构地址', default=u'')
    add_time = models.DateTimeField(default=datetime.now, verbose_name=u'添加时间')
    city = models.ForeignKey(City, verbose_name=u'所在城市')

    class Meta:
        verbose_name = u'课程机构'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name


class Teacher(models.Model):
    org = models.ForeignKey(CourseOrg, verbose_name=u'所属机构')
    name = models.CharField(max_length=100, verbose_name=u'教师名')
    work_year = models.IntegerField(default=0, verbose_name=u'工作年限')
    work_company = models.CharField(max_length=50, verbose_name=u'工作公司')
    work_position = models.CharField(max_length=100, verbose_name=u'工作职位')
    points = models.CharField(max_length=50, verbose_name=u'教学特点')
    fav_nums = models.IntegerField(default=0, verbose_name=u'收藏人数')
    click_nums = models.IntegerField(default=0, verbose_name=u'点击数')
    add_time = models.DateTimeField(default=datetime.now, verbose_name=u'添加时间')

    class Meta:
        verbose_name = u'教师'
        verbose_name_plural = verbose_name
    def __str__(self):
        return self.name